package com.peanut.youfupay.service.other.charge;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.charge.ApplyRechargeRequestDTO;
import com.peanut.youfupay.entity.charge.ApplyRechargeResponseDTO;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户充值
 *
 * @Author :  peanut
 */
@Slf4j
@Service("applyRechargeServiceImpl")
public class ApplyRechargeServiceImpl extends BaseService {
    /**
     * @param funCodeEnum
     * @param applyRechargeRequestDTO
     * @return
     * @throws Exception
     */
    public ApplyRechargeResponseDTO doBusiness(FunCodeEnum funCodeEnum, ApplyRechargeRequestDTO applyRechargeRequestDTO) throws Exception {
        log.info("申请充值开始:{}，{}", funCodeEnum, applyRechargeRequestDTO);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, applyRechargeRequestDTO);
        ApplyRechargeResponseDTO applyRechargeResponseDTO = JSON.parseObject(responseMessage.getResData(), ApplyRechargeResponseDTO.class);
        log.info("申请充值结束:{}", applyRechargeResponseDTO);
        return applyRechargeResponseDTO;
    }

}
